
class Bus{
  public name='lz' //公共属性可以在外部访问
  private list=[]  //私有属性无法在外部访问
  protected age=100 //受保护的只有自身和他的子类可以访问
  dispatch=(cb:any)=>{
    cb&&cb()
  }
}
class Box extends Bus{
  aaa(){
    console.log(this.name,this.age);
  }
}

var obj=new Box()
console.log(obj.name);

//------------------------------------------------
interface Ifunc{
  getName:()=>string
}

class A implements Ifunc{
  a1(){

  }
  a2(){

  }
  getName(){
    return 'aaa'
  }
}
class B implements Ifunc{
  a1(){

  }
  a2(){

  }
  getName(){
    return 'aaa'
  }
}
function init(obj:Ifunc){
   obj.getName()
}
var obj1=new A()
var obj2=new B()

init(obj1)
init(obj2)

export default {}